import Vue from 'vue';
import dialog from './hp-dialog';
const VueDialog = Vue.extend(dialog);
const Dialog = (config) => {
  const dialogInstance = new VueDialog({
    data() {
      return {
        title: config.title,
        content: config.content,
        isShow: true
      }
    },
    methods: {
      hide() {
        this.isShow = false;
      },
      confirm() {
        config.confirm && config.confirm();
        this.hide();
      },
      cancel() {
        config.cancel && config.cancel();
        this.hide();
      }
    }
  });
  document.body.appendChild(dialogInstance.$mount().$el);
};
export const Eldialog = {
  install(Vue) {
    Vue.prototype.$dialog = Dialog;
  }
};
